package org.dreamwork.sso.saml2.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;

/**
 * Created with IntelliJ IDEA.
 * User: seth.yang
 * Date: 13-8-19
 * Time: 下午3:17
 */
public class SecretHelper {
    private static Log logger = LogFactory.getLog (SecretHelper.class);

    public static SecretKey createAESKey () {
        try {
            KeyGenerator g = KeyGenerator.getInstance ("aes");
            g.init (128);
            return g.generateKey ();
        } catch (Exception ex) {
            logger.warn (ex.getMessage (), ex);
            throw new RuntimeException (ex);
        }
    }
}